package com.kevin.file.service;

import org.springframework.ai.chat.client.ChatClient;
import org.springframework.stereotype.Service;

/**
 * @author 张帆
 * @date: 2025/4/1 16:06
 */
@Service
public class TextAiService {
    private final ChatClient chatClient;

    public TextAiService(ChatClient.Builder chatClientBuilder) {
        this.chatClient = chatClientBuilder.build();
    }

    public String generation(String userInput) {
        return this.chatClient.prompt()
                .user(userInput)
                .call()
                .content();
    }

    public String generation(String prompt, String userInput) {
        return this.chatClient.prompt(prompt)
                .user(userInput)
                .call()
                .content();
    }
}
